home *** CD-ROM | disk | FTP | other *** search
/ The Net Power 1997 April / NETDisc0497.iso / pc / demos / mmedia / dirwin / data.z / ANIMWIZ.DIR / 00002_Utility routines.ls < prev    next >
Encoding:
Text File  |  1996-03-15  |  2.5 KB  |  102 lines

  1. on wait nTicks
  2.   set endTime to the ticks + nTicks
  3.   repeat while the ticks < endTime
  4.   end repeat
  5. end
  6.  
  7. on PressButton
  8.   set chButton to the clickOn
  9.   set castNumButtonUp to the castNum of sprite chButton
  10.   set btnUpName to the name of cast castNumButtonUp
  11.   set nWordsInName to the number of words in btnUpName
  12.   if nWordsInName > 1 then
  13.     if word 2 of btnUpName = "Gray" then
  14.       return 0
  15.     end if
  16.   end if
  17.   if nWordsInName = 1 then
  18.     set castNumButtonDown to castNumButtonUp + 1
  19.   else
  20.     set castNumBase to the number of member word 1 of btnUpName
  21.     set castNumButtonDown to castNumBase + 1
  22.   end if
  23.   set downFlag to 1
  24.   repeat while downFlag
  25.     if rollOver(chButton) then
  26.       set the castNum of sprite chButton to castNumButtonDown
  27.     else
  28.       set the castNum of sprite chButton to castNumButtonUp
  29.     end if
  30.     updateStage()
  31.     set downFlag to the stillDown
  32.   end repeat
  33.   set the castNum of sprite chButton to castNumButtonUp
  34.   updateStage()
  35.   if rollOver(chButton) then
  36.     return 1
  37.   else
  38.     return 0
  39.   end if
  40. end
  41.  
  42. on PressCheckBox
  43.   set chCheckBox to the clickOn
  44.   set castNumCheckBoxUp to the castNum of sprite chCheckBox
  45.   set checkBoxUpName to the name of cast castNumCheckBoxUp
  46.   set nWordsInName to the number of words in checkBoxUpName
  47.   if nWordsInName > 1 then
  48.     if word 2 of checkBoxUpName = "Gray" then
  49.       return 0
  50.     end if
  51.   end if
  52.   set castNumCheckBoxDown to castNumCheckBoxUp + 1
  53.   set downFlag to 1
  54.   repeat while downFlag
  55.     if rollOver(chCheckBox) then
  56.       set the castNum of sprite chCheckBox to castNumCheckBoxDown
  57.     else
  58.       set the castNum of sprite chCheckBox to castNumCheckBoxUp
  59.     end if
  60.     updateStage()
  61.     set downFlag to the stillDown
  62.   end repeat
  63.   if rollOver(chCheckBox) then
  64.     return 1
  65.   else
  66.     set the castNum of sprite chCheckBox to castNumCheckBoxUp
  67.     return 0
  68.   end if
  69. end
  70.  
  71. on IncrMod theCurrentValue, theMaxValue
  72.   if theCurrentValue = theMaxValue then
  73.     return 1
  74.   else
  75.     return theCurrentValue + 1
  76.   end if
  77. end
  78.  
  79. on DecrMod theCurrentValue, theMaxValue
  80.   if theCurrentValue = 1 then
  81.     return theMaxValue
  82.   else
  83.     return theCurrentValue - 1
  84.   end if
  85. end
  86.  
  87. on HitWhoH spriteNum, theMax
  88.   set theRealWidth to the right of sprite spriteNum - the left of sprite spriteNum
  89.   set who to ((the mouseH - the left of sprite spriteNum) * theMax / theRealWidth) + 1
  90.   if who <= 1 then
  91.     set who to 1
  92.   end if
  93.   if who > theMax then
  94.     set who to theMax
  95.   end if
  96.   return who
  97. end
  98.  
  99. on round n
  100.   return integer(n + 0.49000000000000005)
  101. end
  102.